import 'package:flutter/material.dart';

/// 类别
class CategoryPage extends StatefulWidget {
  CategoryPage({Key key}) : super(key: key);

  @override
  _CategoryPageState createState() => _CategoryPageState();
}

class _CategoryPageState extends State<CategoryPage> {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 10,
      child: Scaffold(
        appBar: AppBar(
          backgroundColor: Colors.green,
          title: TabBar(
            isScrollable: true,
            indicatorColor: Colors.red,
            indicatorWeight: 3.0,
            labelColor: Colors.red,
            unselectedLabelColor: Colors.white,
            indicatorSize: TabBarIndicatorSize.label,
            tabs: [
              Tab(text: '热门'),
              Tab(text: '推荐'),
              Tab(text: '关注'),
              Tab(text: 'NBA'),
              Tab(text: '音乐'),
              Tab(text: '懂车帝'),
              Tab(text: '生活'),
              Tab(text: '新时代'),
              Tab(text: '军事'),
              Tab(text: '财经'),
            ],
          ),
        ),
        body: TabBarView(
          children: [
            ListView(
              children: <Widget>[
                ListTile(title: Text('tab0_0')),
                ListTile(title: Text('tab0_1')),
                ListTile(title: Text('tab0_2')),
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(title: Text('tab1_0')),
                ListTile(title: Text('tab1_1')),
                ListTile(title: Text('tab1_2')),
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(title: Text('tab2_0')),
                ListTile(title: Text('tab2_1')),
                ListTile(title: Text('tab2_2')),
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(title: Text('tab2_0')),
                ListTile(title: Text('tab2_1')),
                ListTile(title: Text('tab2_2')),
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(title: Text('tab2_0')),
                ListTile(title: Text('tab2_1')),
                ListTile(title: Text('tab2_2')),
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(title: Text('tab2_0')),
                ListTile(title: Text('tab2_1')),
                ListTile(title: Text('tab2_2')),
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(title: Text('tab2_0')),
                ListTile(title: Text('tab2_1')),
                ListTile(title: Text('tab2_2')),
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(title: Text('tab2_0')),
                ListTile(title: Text('tab2_1')),
                ListTile(title: Text('tab2_2')),
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(title: Text('tab2_0')),
                ListTile(title: Text('tab2_1')),
                ListTile(title: Text('tab2_2')),
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(title: Text('tab2_0')),
                ListTile(title: Text('tab2_1')),
                ListTile(title: Text('tab2_2')),
              ],
            )
          ],
        ),
      ),
    );
  }
}
